using System;
using System.IO;
using System.Reflection;

namespace CriticalSystems.Instrumentation
{
    internal class ResourceUtilities
    {
        internal static Stream GetEmbeddedResource(string name)
        {
            Assembly assembly = Assembly.GetCallingAssembly();
            return GetEmbeddedResource(assembly, name);
        }

        internal static Stream GetEmbeddedResource(Assembly assembly, string name)
        {
            Stream resourceStream = assembly.GetManifestResourceStream(name);
            return resourceStream;
        }

        internal static Stream GetEmbeddedResource(Type type, string name)
        {
            return GetEmbeddedResource(type.Assembly, type.Namespace + "." + name);
        }
    }
}